﻿import QtQuick
import QtQuick.Templates as T
import FilUI

T.MenuBarItem {
    id: control

    property bool disabled: false
    property color textColor: {
        if (!enabled) {
            return Qt.rgba(160/255, 160/255, 160/255, 1)
        }
        if (pressed) {
            return Qt.rgba(96/255, 96/255, 96/255, 1)
        }
        return Qt.rgba(0, 0, 0, 1)
    }

    enabled: !disabled
    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
                            implicitContentWidth + leftPadding + rightPadding)
    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
                             implicitContentHeight + topPadding + bottomPadding,
                             implicitIndicatorHeight + topPadding + bottomPadding)
    spacing: 6
    padding: 6
    leftPadding: 12
    rightPadding: 16
    icon.width: 24
    icon.height: 24
    icon.color: control.palette.buttonText
    contentItem: FilText {
        verticalAlignment: Text.AlignVCenter
        text: control.text
        color: control.textColor
    }
    background: Rectangle {
        implicitWidth: 30
        implicitHeight: 30
        radius: 3
        color: {
            if (control.highlighted) {
                return FilTheme.itemHoverColor
            }
            return FilTheme.itemNormalColor
        }
    }
}
